package pet

import "github.com/hajimehoshi/ebiten/v2"

// 状态
const (
	Idle   = 0 // 空闲
	Attack = 1 // 攻击
	Run    = 2 // 跑
	Walk   = 3 // 行走
	Sit    = 4 // 坐
)

// 方向
const (
	Down  = 0
	Left  = 1
	Right = 2
	UP    = 3
)

type Mod_Pet struct {
	width        int
	height       int
	pos_x, pos_y float64 //位置
	imgs         map[int][]*ebiten.Image
	status       int //状态
	direction    int // 朝向
	ticker       int //时钟
	step         int
}

func New() *Mod_Pet {

	return &Mod_Pet{}
}

func (this *Mod_Pet) Draw(screen *ebiten.Image) {
	if this.ticker%10 == 0 {
		this.step++
	}
	screen.DrawImage(this.imgs[this.status][this.step%3], &ebiten.DrawImageOptions{})
}

func (this *Mod_Pet) Update() error {
	this.ticker++

	return nil
}

func (this *Mod_Pet) Layout(outsideWidth, outsideHeight int) (int, int) {
	return this.width, this.height
}
